<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/static/video-js.min.css">
</head>
<body>
<video id="example_video_1" class="video-js vjs-default-skin vjs-big-play-centered"
       controls preload="auto" width="640" height="264"
       poster="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1601231531469&di=4cf213d537813c05c16ac26a8346466f&imgtype=0&src=http%3A%2F%2Fa0.att.hudong.com%2F56%2F12%2F01300000164151121576126282411.jpg"
       data-setup='{"example_option":true}'>
    <source src="/api/video/downVideo?vid=ba7bf8a65d2e40608b0c533925ab9794" type='video/mp4' id="video_source"/>
</video>

<!--<video src="/api/video/downVideo?vid=ba7bf8a65d2e40608b0c533925ab9794" controls="controls">-->
<!--    your browser does not support the video tag-->
<!--</video>-->

<button id="play">播放</button>
<br>
<button id="pause">停止</button>
<br>
<button id="setTime">设置进度</button>
<br>

<script type="text/javascript" src="/static/jquery.js"></script>
<script type="text/javascript" src="/static/video.min.js"></script>
<script type="text/javascript">
    var myPlayer = null;
    $(function () {
        myPlayer = videojs('example_video_1');
        /*===================================================================*/
        /**
         * 为按钮绑定事件
         */
        $("#play").bind('click', function () {
            fnPlay(myPlayer);
        });

        /**
         * 为按钮绑定事件
         */
        $("#pause").bind('click', function () {
            fnPause(myPlayer);
        });

        /**
         * 为按钮绑定事件
         */
        $("#setTime").bind('click', function () {
            fnSetVideoTime(myPlayer, 12);
        })


        /*===================================================================*/

        /**
         * 播放事件
         * @param videoObj 播放对象信息
         */
        function fnPlay(videoObj) {
            videoObj.play();
        }

        /**
         * 暂停事件
         * @param videoObj 播放对象信息
         */
        function fnPause(videoObj) {
            videoObj.pause();
        }

        /**
         * 设置播放进度
         * @param time
         */
        function fnSetVideoTime(videoObj, time) {
            console.log(myPlayer.currentTime())
            myPlayer.currentTime(120);
        }

    })


</script>
</body>
</html>